package com.wwtech.epp.ui.activity.work.module;

import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.entity.ProjectEntity;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.work.ProjectListFragment;
import com.wwtech.epp.ui.activity.work.contract.ProjectListContract;
import com.wwtech.epp.ui.activity.work.presenter.ProjectListPresenter;
import com.wwtech.epp.ui.adapter.work.ProjectListAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: The moduele of ProjectListFragment, provide field for ProjectListFragment
 * @date 2017/09/15 12:56:42
 */
@Module
public class ProjectListModule {
    private final ProjectListContract.View mView;


    public ProjectListModule(ProjectListContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public ProjectListPresenter provideProjectListPresenter(HttpAPIWrapper httpAPIWrapper, ProjectListFragment mFragment) {
        return new ProjectListPresenter(httpAPIWrapper, mView, mFragment);
    }

    @Provides
    @ActivityScope
    public ProjectListFragment provideProjectListFragment() {
        return (ProjectListFragment) mView;
    }

    @Provides
    @ActivityScope
    public ProjectListAdapter provideProjectListAdapter() {
        return new ProjectListAdapter(new ArrayList<ProjectEntity.DataBean.ListBean>());
    }
}